﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace myScheduler
{
    public partial class Registration : System.Web.UI.Page
    {
        RegistrationModel ModelRegistration = new RegistrationModel();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["msg"] != null)
            {
               lblRegister.Text = Request.QueryString["msg"];
                pnlRegister.Visible = false;
            }
            else
            {
                lblRegister.Text = "";
                pnlRegister.Visible = true;
            }
        }

        protected void btnRegister_onClick(object sender, EventArgs e)
        {
            string notification = "";
            notification = ModelRegistration.RegisterUser(txtUsername.Text, txtPassword1.Text, txtPassword2.Text, txtEmail.Text, txtStudentId.Text);
            Response.Redirect("/registration.aspx?msg=" + notification);
        }
    }
}